At the present time the construction of motor vehicles has become remarkably electronic. Instruments, including, among other things, the engine, installed in each section of a motor vehicle are interconnected via a control computer so that complex operations can be performed.
In such a case, even if a malfunction of a certain single installed instrument is detected, often the true cause cannot be determined because of the interrelationship with other installed instruments unless a wide range of data (diagnostic data) indicating the state of the motor vehicle at the time the malfunction is detected is collected. Also, after a temporary malfunction, there is a possibility that the malfunction will be corrected naturally. Further, often this temporary malfunction is a sign that a complete failure will occur; however, it is quite difficult to find the cause thereof by performing an inspection after getting out of the motor vehicle.
Accordingly, a self-diagnosing apparatus is proposed in Japanese Patent Laid-Open No. 62-142849, in which diagnostic data from each section of a motor vehicle is updated and stored in a memory where the contents are stored at specified intervals even when the power supply is shut down; updating of the contents of the memory being inhibited (frozen) after a malfunction of the installed instrument is detected, so that the cause of the malfunction can be determined accurately after getting out of the motor vehicle.
An apparatus is proposed in Japanese Patent Laid-Open No. 3-92564, in which control programs in addition to the diagnostic data are stored in the memory in order to determine the cause of a malfunction more accurately.
In the above-described conventional apparatuses, since the above-mentioned diagnostic data is stored by a microcomputer operation, it takes some time, though slight, from when a malfunction is detected until data is frozen. If the ignition switch is turned off between the time of malfunction detection and freezing the data, the microcomputer stops its processing, and the diagnostic data obtained before the ignition switch has been turned off is not frozen. Therefore, the diagnostic data is reset to an initial state when the ignition switch is turned on again to start the control program, making it impossible to analyze the malfunction, which is problematical. Also, if the diagnostic data obtained when a malfunction is detected again after the ignition switch is turned on again is frozen despite the first detection of the malfunction before the ignition switch has been turned off, diagnostic data (data obtained when the ignition switch is turned on again) different from that when the first malfunction has occurred, will be output. As a result, there is a risk that the cause of the malfunction will be analyzed erroneously, or it will become impossible to investigate the cause of the malfunction.
In the above-described conventional apparatuses, the diagnostic data is stored and updated in the memory at regular intervals up to the time a malfunction occurs. This storing and updating becomes a burden depending upon the computing speed of the CPU, and it is conceivable that the diagnostic data is stored and frozen only after the occurrence of the malfunction is detected.
However, there is a problem in that if the ignition switch is turned off during the time from when the malfunction is detected until when all the diagnostic data is completely stored, since non-updated erroneous data remains, new and old data are present when the diagnostic data is output, causing an erroneous analysis of the malfunction. To prevent this erroneous analysis, it is conceivable that a main relay for supplying power to the CPU for some time after the ignition switch has been turned off is disposed. This results in increased cost because of the addition of hardware.
The present invention solves the above-described problems of the prior art. It is an object of the present invention to accurately analyze the cause of a malfunction even when the power supply is shut off immediately after the malfunction is detected.
It is another object of the present invention to prevent problems, such as erasure of diagnostic data as a result of the power supply being shut off, storing of erroneous diagnostic data, outputting of erroneous diagnostic data, or erroneous analysis on the basis of erroneous diagnostic data, by first storing the fact that a malfunction is detected immediately after detection in order to make it possible to confirm, when the supply of power is restarted, the fact that the power supply has been shut off during the malfunction detecting operation and the diagnostic data operation process after the detecting operation.